package com.thinkgem.jeesite.modules.export.service;

import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.ui.Model;

import com.thinkgem.jeesite.common.mapper.JsonMapper;
import com.thinkgem.jeesite.common.service.CrudService;
import com.thinkgem.jeesite.common.utils.DateUtils;
import com.thinkgem.jeesite.common.utils.StringUtils;
import com.thinkgem.jeesite.modules.export.dao.Export6_2Dao;
import com.thinkgem.jeesite.modules.export.entity.Export6_2;
import com.thinkgem.jeesite.modules.export.entity.ExportChildhelp;
import com.thinkgem.jeesite.modules.sys.service.OfficeService;
import com.thinkgem.jeesite.modules.sys.service.SysAreaService;
import com.thinkgem.jeesite.modules.sys.utils.TimeUtils;

/**
 * 报表6-2 Service
 * 
 * @author Jack
 * @date 2017年10月23日 下午6:39:04
 * @description
 */

@Service
public class Export6_2Service extends CrudService<Export6_2Dao, Export6_2> {
	@Autowired
	Export6_2Dao dao;
	@Autowired
	OfficeService officeService;
	@Autowired
	SysAreaService sysAreaService;

	// ------------------------------------------第二类疫苗接种情况报表6-2开始-----------------------------------------------------------------//
	/**
	 * 第二类疫苗接种情况报表6-2数据处理
	 * @author Jack
	 * @date 2017年10月24日 上午9:07:51
	 * @description
	 * @param request
	 * @param export
	 * @param model
	 * @param yearstr
	 * @param monthstr
	 *
	 */
//	public void dataService(HttpServletRequest request, Export export, Model model, String yearstr, String monthstr) {
//		String vaccCode = "0201, 1701, 2501, 3801, 0601, 1702, 2502, 4701, 0401, 1703, 2901,2902 , 0303 , 1401, 1901,1902, 3401, 5201, 1301, 1903, 3601, 5001, 1201, 2001,"
//				+ " 2801,2802,2803,2804,2805, 4901, 0901, 2301, 3001, 5301, 1001, 2201, 3301, 5401, 1801, 2401, 3701, 1802, 2101,2102,2103,2106, 3501";
//		DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
//		if (StringUtils.isNotBlank(yearstr) && StringUtils.isNotBlank(monthstr)) {
//			String begintime = getFirstDayOfMonth(Integer.valueOf(yearstr), Integer.valueOf(monthstr) - 1);
//			String endtime = getLastDayOfMonth(Integer.valueOf(yearstr), Integer.valueOf(monthstr) - 1);
//			export.setBegintime(begintime);
//			export.setEndtime(endtime);
//			model.addAttribute("yearstr", yearstr);
//			model.addAttribute("monthstr", monthstr);
//			model.addAttribute("date", df.format(new Date()));
//		} else {
//			// 没有时间默认上月
//			Integer endMonth = Integer.parseInt(DateUtils.getMonth());
//			export.setBegintime(getFirstDayOfMonth(Integer.valueOf(DateUtils.formatDate(new Date(), "yyyy")),
//					Integer.valueOf(DateUtils.formatDate(new Date(), "MM")) - 1));
//			export.setEndtime(getLastDayOfMonth(Integer.valueOf(DateUtils.formatDate(new Date(), "yyyy")),
//					Integer.valueOf(DateUtils.formatDate(new Date(), "MM")) - 1));
//			yearstr = DateUtils.formatDate(new Date(), "yyyy");
//			monthstr = DateUtils.formatDate(new Date(), "MM");
//			model.addAttribute("yearstr", DateUtils.formatDate(new Date(), "yyyy"));
//			model.addAttribute("monthstr", endMonth-1);
//			model.addAttribute("date", df.format(new Date()));
//		}
//		// 根据code 查询所属的省，市 ，区
//		String code = officeService.get(OfficeService.getFirstOffice()).getCode();// 获取一级单位编码 3406030301
//		if (StringUtils.isNotBlank(code)) {
//			String sheng = StringUtils.substring(code, 0, 2);
//			String shi = StringUtils.substring(code, 2, 4);
//			String qu = StringUtils.substring(code, 4, 6);
//			model.addAttribute("sheng", sysAreaService.getAreaNameById(Integer.parseInt(sheng + "0000")).getName());
//			model.addAttribute("shi", sysAreaService.getAreaNameById(Integer.parseInt(sheng + shi + "00")).getName());
//			model.addAttribute("qu", sysAreaService.getAreaNameById(Integer.parseInt(sheng + shi + qu)).getName());
//		}
//
//		if (StringUtils.isNotBlank(yearstr) && StringUtils.isNotBlank(monthstr)) {
//			HashMap<String, Object> map = new HashMap<String, Object>();
//			map.put("startTime", export.getBegintime());
//			map.put("endTime", export.getEndtime());
//			// 转换疫苗编码
//			List<String> list = StringUtils.splitToList(vaccCode, ",");
//			map.put("list", list);
//			// 统计数据
//			List<HashMap<String, String>> chuxuereMaps = new LinkedList<HashMap<String, String>>();
//			List<HashMap<String, String>> jiaganjianduMaps = new LinkedList<HashMap<String, String>>();
//			List<HashMap<String, String>> kuangquanMaps = new LinkedList<HashMap<String, String>>();
//			List<HashMap<String, String>> liuganMaps = new LinkedList<HashMap<String, String>>();
//			List<HashMap<String, String>> maps = typeTwoVaccReport6_2(map);
//
//			for (int i = 0; i < maps.size(); i++) {
//				// 处理:出血热,甲肝减毒,狂犬,流感的各个疫苗小类
//				HashMap<String, String> tmpMap = maps.get(i);
//				if (tmpMap.get("id").equals("2901") || tmpMap.get("id").equals("2902")) {
//					// 出血热总和统计
//					chuxuereMaps.add(tmpMap);
//				}
//				if (tmpMap.get("id").equals("1901") || tmpMap.get("id").equals("1902")) {
//					// 甲肝减毒总和统计
//					jiaganjianduMaps.add(tmpMap);
//				}
//				if (tmpMap.get("id").equals("2801") || tmpMap.get("id").equals("2802")
//						|| tmpMap.get("id").equals("2803") || tmpMap.get("id").equals("2804")
//						|| tmpMap.get("id").equals("2805")) {
//					// 狂犬总和统计
//					kuangquanMaps.add(tmpMap);
//				}
//				if (tmpMap.get("id").equals("2101") || tmpMap.get("id").equals("2102")
//						|| tmpMap.get("id").equals("2103") || tmpMap.get("id").equals("2106")) {
//					// 流感总和统计
//					liuganMaps.add(tmpMap);
//				}
//			}
//
//			// 删除maps出血热,甲肝减毒,狂犬,流感小项
//			List<HashMap<String, String>> delList = new ArrayList<HashMap<String, String>>();
//			for (int i = 0; i < maps.size(); i++) {
//				HashMap<String, String> delMap = maps.get(i);
//				if (delMap.get("id").equals("2901") || delMap.get("id").equals("2902")
//						|| delMap.get("id").equals("1901") || delMap.get("id").equals("1902")
//						|| delMap.get("id").equals("2801") || delMap.get("id").equals("2802")
//						|| delMap.get("id").equals("2803") || delMap.get("id").equals("2804")
//						|| delMap.get("id").equals("2805") || delMap.get("id").equals("2101")
//						|| delMap.get("id").equals("2102") || delMap.get("id").equals("2103")
//						|| delMap.get("id").equals("2106")) {
//					delList.add(delMap);
//				}
//			}
//			for (HashMap<String, String> i : delList) {
//				maps.remove(i);
//			}
//
//			// 暂存num和Map的变量
//			int sum = 0;
//			HashMap<String, String> innerMap = null;
//
//			// 出血热总数计算和结果拼接
//			innerMap = new HashMap<String, String>();
//			for (int i = 0; i < chuxuereMaps.size(); i++) {
//				HashMap<String, String> tmpMap = chuxuereMaps.get(i);
//				sum += Integer.parseInt(String.valueOf((tmpMap.get("num"))));
//			}
//			innerMap.put("id", "2900");
//			innerMap.put("name", "出血热(HF)");
//			innerMap.put("num", sum + "");
//			chuxuereMaps.clear();
//			chuxuereMaps.add(innerMap);
//			sum = 0;
//			innerMap = null;
//
//			// 甲肝减毒总数计算和结果拼接
//			innerMap = new HashMap<String, String>();
//			for (int i = 0; i < jiaganjianduMaps.size(); i++) {
//				HashMap<String, String> tmpMap = jiaganjianduMaps.get(i);
//				sum += Integer.parseInt(String.valueOf((tmpMap.get("num"))));
//			}
//			innerMap.put("id", "1900");
//			innerMap.put("name", "甲肝减毒(HepA-L)");
//			innerMap.put("num", sum + "");
//			jiaganjianduMaps.clear();
//			jiaganjianduMaps.add(innerMap);
//			sum = 0;
//			innerMap = null;
//
//			// 狂犬总和计算和结果拼接
//			innerMap = new HashMap<String, String>();
//			for (int i = 0; i < kuangquanMaps.size(); i++) {
//				HashMap<String, String> tmpMap = kuangquanMaps.get(i);
//				sum += Integer.parseInt(String.valueOf((tmpMap.get("num"))));
//			}
//			innerMap.put("id", "2800");
//			innerMap.put("name", "狂犬病(Rab)");
//			innerMap.put("num", sum + "");
//			kuangquanMaps.clear();
//			kuangquanMaps.add(innerMap);
//			sum = 0;
//			innerMap = null;
//
//			// 流感总数计算和结果拼接
//			innerMap = new HashMap<String, String>();
//			for (int i = 0; i < liuganMaps.size(); i++) {
//				HashMap<String, String> tmpMap = liuganMaps.get(i);
//				sum += Integer.parseInt(String.valueOf((tmpMap.get("num"))));
//			}
//			innerMap.put("id", "2100");
//			innerMap.put("name", "流感(Flu)");
//			innerMap.put("num", sum + "");
//			liuganMaps.clear();
//			liuganMaps.add(innerMap);
//			sum = 0;
//			innerMap = null;
//
//			String chuxuereStr = JsonMapper.toJsonString(chuxuereMaps);
//			String jiaganjianduStr = JsonMapper.toJsonString(jiaganjianduMaps);
//			String kuangquanStr = JsonMapper.toJsonString(kuangquanMaps);
//			String liuganStr = JsonMapper.toJsonString(liuganMaps);
//			String mapsStr = JsonMapper.toJsonString(maps);
//			String result = mapsStr.replace("]", "") + "," + chuxuereStr.replace("[", "").replace("]", "") + ","
//					+ jiaganjianduStr.replace("[", "").replace("]", "") + ","
//					+ kuangquanStr.replace("[", "").replace("]", "") + "," + liuganStr.replace("[", "");
//			model.addAttribute("maps", result);
//		}
//		model.addAttribute("username", UserUtils.getUser().getName());
//		model.addAttribute("year", DateUtils.formatDate(new Date(), "yyyy"));
//		model.addAttribute("month", DateUtils.formatDate(new Date(), "MM"));
//		model.addAttribute("date", DateUtils.formatDate(new Date(), "yyyy年MM月dd日"));
//		model.addAttribute("off", OfficeService.getFirstOffice().getName());
//
//	}

	// ------------------------------------------第二类疫苗接种情况报表6-2结束-----------------------------------------------------------------//
	// ------------------------------------------常规免疫接种情况6-2汇总表开始-----------------------------------------------------------------//
	/**
	 * 常规免疫接种情况6-2汇总表 数据处理逻辑
	 * 
	 * @author Jack
	 * @return
	 * @date 2017年10月24日 上午9:22:01
	 * @description
	 *
	 */
	public String collectDataService(ExportChildhelp exportChildhelp, Model model) {
		if (StringUtils.isNotBlank(exportChildhelp.getVaccCode())) {
			HashMap<String, Object> map = new HashMap<String, Object>();
			String year = exportChildhelp.getYearStr();
			String startMonth = exportChildhelp.getStartMonth();
			String endMonth = exportChildhelp.getEndMonth();
			String startTime = TimeUtils.getFirstDayOfMonth(Integer.valueOf(year), Integer.valueOf(startMonth)-1) + " 23:59:59";
			String endTime = TimeUtils.getLastDayOfMonth(Integer.valueOf(year), Integer.valueOf(endMonth)-1) + " 23:59:59";
			map.put("startTime", startTime);
			map.put("endTime", endTime);

			// 转换疫苗名称
			List<String> list = StringUtils.splitToList(exportChildhelp.getVaccCode(), ",");
			map.put("list", list);

			// 统计数据
			List<HashMap<String, String>> yi_gan_Maps = new LinkedList<HashMap<String, String>>();
			List<HashMap<String, String>> chu_xue_re_Maps = new LinkedList<HashMap<String, String>>();
			List<HashMap<String, String>> jia_gan_jian_du_Maps = new LinkedList<HashMap<String, String>>();
			List<HashMap<String, String>> kuang_quan_Maps = new LinkedList<HashMap<String, String>>();
			List<HashMap<String, String>> feng_zhen_Maps = new LinkedList<HashMap<String, String>>();
			List<HashMap<String, String>> chang_dao_71_Maps = new LinkedList<HashMap<String, String>>();
			List<HashMap<String, String>> yi_nao_mie_huo_Maps = new LinkedList<HashMap<String, String>>();
			List<HashMap<String, String>> liu_gan_Maps = new LinkedList<HashMap<String, String>>();
			List<HashMap<String, String>> maps = typeTwoVaccReport6_2(map);

			for (int i = 0; i < maps.size(); i++) {
				// 处理:乙肝,出血热,甲肝减毒,狂犬,风疹,肠道71型病毒,乙脑灭活,流感的各个疫苗小类
				HashMap<String, String> tmpMap = maps.get(i);
				if (tmpMap.get("id").equals("0201") || tmpMap.get("id").equals("0202")
						|| tmpMap.get("id").equals("0203")) {
					// 乙肝总和统计
					yi_gan_Maps.add(tmpMap);
				}
				if (tmpMap.get("id").equals("2901") || tmpMap.get("id").equals("2902")
						|| tmpMap.get("id").equals("2903") || tmpMap.get("id").equals("2904")
						|| tmpMap.get("id").equals("2905") || tmpMap.get("id").equals("2906")) {
					// 出血热总和统计
					chu_xue_re_Maps.add(tmpMap);
				}
				if (tmpMap.get("id").equals("1901") || tmpMap.get("id").equals("1902")) {
					// 甲肝减毒总和统计
					jia_gan_jian_du_Maps.add(tmpMap);
				}
				if (tmpMap.get("id").equals("2801") || tmpMap.get("id").equals("2802")
						|| tmpMap.get("id").equals("2803") || tmpMap.get("id").equals("2804")
						|| tmpMap.get("id").equals("2805")) {
					// 狂犬总和统计
					kuang_quan_Maps.add(tmpMap);
				}
				if (tmpMap.get("id").equals("1101") || tmpMap.get("id").equals("1102")) {
					// 风疹总和统计
					feng_zhen_Maps.add(tmpMap);
				}
				if (tmpMap.get("id").equals("5401") || tmpMap.get("id").equals("5402")) {
					// 肠道病毒71总和统计
					chang_dao_71_Maps.add(tmpMap);
				}
				if (tmpMap.get("id").equals("1802") || tmpMap.get("id").equals("1803")) {
					// 乙脑灭活总和统计
					yi_nao_mie_huo_Maps.add(tmpMap);
				}
				if (tmpMap.get("id").equals("2101") || tmpMap.get("id").equals("2102")
						|| tmpMap.get("id").equals("2103") || tmpMap.get("id").equals("2106")) {
					// 流感总和统计
					liu_gan_Maps.add(tmpMap);
				}
			}

			// 删除maps出血热,甲肝减毒,狂犬,流感小项
			List<HashMap<String, String>> delList = new ArrayList<HashMap<String, String>>();
			for (int i = 0; i < maps.size(); i++) {
				HashMap<String, String> delMap = maps.get(i);
				if (delMap.get("id").equals("0201") || delMap.get("id").equals("0202")
						|| delMap.get("id").equals("0203") || delMap.get("id").equals("2901")
						|| delMap.get("id").equals("2902") || delMap.get("id").equals("2903")
						|| delMap.get("id").equals("2904") || delMap.get("id").equals("2905")
						|| delMap.get("id").equals("2906") || delMap.get("id").equals("1901")
						|| delMap.get("id").equals("1902") || delMap.get("id").equals("2801")
						|| delMap.get("id").equals("2802") || delMap.get("id").equals("2803")
						|| delMap.get("id").equals("2804") || delMap.get("id").equals("2805")
						|| delMap.get("id").equals("1101") || delMap.get("id").equals("1102")
						|| delMap.get("id").equals("5401") || delMap.get("id").equals("5402")
						|| delMap.get("id").equals("1802") || delMap.get("id").equals("1803")
						|| delMap.get("id").equals("2101") || delMap.get("id").equals("2102")
						|| delMap.get("id").equals("2103") || delMap.get("id").equals("2106")) {
					delList.add(delMap);
				}
			}
			for (HashMap<String, String> i : delList) {
				maps.remove(i);
			}

			// 暂存num和Map的变量
			int sum = 0;
			HashMap<String, String> innerMap = null;

			// 乙肝总数计算和结果拼接
			innerMap = new HashMap<String, String>();
			for (int i = 0; i < yi_gan_Maps.size(); i++) {
				HashMap<String, String> tmpMap = yi_gan_Maps.get(i);
				sum += Integer.parseInt(String.valueOf((tmpMap.get("num"))));
			}
			innerMap.put("id", "2900");
			innerMap.put("name", "出血热(HF)");
			innerMap.put("num", sum + "");
			yi_gan_Maps.clear();
			yi_gan_Maps.add(innerMap);
			sum = 0;
			innerMap = null;

			// 出血热总数计算和结果拼接
			innerMap = new HashMap<String, String>();
			for (int i = 0; i < chu_xue_re_Maps.size(); i++) {
				HashMap<String, String> tmpMap = chu_xue_re_Maps.get(i);
				sum += Integer.parseInt(String.valueOf((tmpMap.get("num"))));
			}
			innerMap.put("id", "2900");
			innerMap.put("name", "出血热(HF)");
			innerMap.put("num", sum + "");
			chu_xue_re_Maps.clear();
			chu_xue_re_Maps.add(innerMap);
			sum = 0;
			innerMap = null;

			// 甲肝减毒总数计算和结果拼接
			innerMap = new HashMap<String, String>();
			for (int i = 0; i < jia_gan_jian_du_Maps.size(); i++) {
				HashMap<String, String> tmpMap = jia_gan_jian_du_Maps.get(i);
				sum += Integer.parseInt(String.valueOf((tmpMap.get("num"))));
			}
			innerMap.put("id", "1900");
			innerMap.put("name", "甲肝减毒(HepA-L)");
			innerMap.put("num", sum + "");
			jia_gan_jian_du_Maps.clear();
			jia_gan_jian_du_Maps.add(innerMap);
			sum = 0;
			innerMap = null;

			// 狂犬总和计算和结果拼接
			innerMap = new HashMap<String, String>();
			for (int i = 0; i < kuang_quan_Maps.size(); i++) {
				HashMap<String, String> tmpMap = kuang_quan_Maps.get(i);
				sum += Integer.parseInt(String.valueOf((tmpMap.get("num"))));
			}
			innerMap.put("id", "2800");
			innerMap.put("name", "狂犬病(Rab)");
			innerMap.put("num", sum + "");
			kuang_quan_Maps.clear();
			kuang_quan_Maps.add(innerMap);
			sum = 0;
			innerMap = null;

			// 风疹总数计算和结果拼接
			innerMap = new HashMap<String, String>();
			for (int i = 0; i < feng_zhen_Maps.size(); i++) {
				HashMap<String, String> tmpMap = feng_zhen_Maps.get(i);
				sum += Integer.parseInt(String.valueOf((tmpMap.get("num"))));
			}
			innerMap.put("id", "2100");
			innerMap.put("name", "流感(Flu)");
			innerMap.put("num", sum + "");
			feng_zhen_Maps.clear();
			feng_zhen_Maps.add(innerMap);
			sum = 0;
			innerMap = null;

			// 肠道71型病毒总数计算和结果拼接
			innerMap = new HashMap<String, String>();
			for (int i = 0; i < chang_dao_71_Maps.size(); i++) {
				HashMap<String, String> tmpMap = chang_dao_71_Maps.get(i);
				sum += Integer.parseInt(String.valueOf((tmpMap.get("num"))));
			}
			innerMap.put("id", "2100");
			innerMap.put("name", "流感(Flu)");
			innerMap.put("num", sum + "");
			chang_dao_71_Maps.clear();
			chang_dao_71_Maps.add(innerMap);
			sum = 0;
			innerMap = null;

			// 乙脑灭活总数计算和结果拼接
			innerMap = new HashMap<String, String>();
			for (int i = 0; i < yi_nao_mie_huo_Maps.size(); i++) {
				HashMap<String, String> tmpMap = yi_nao_mie_huo_Maps.get(i);
				sum += Integer.parseInt(String.valueOf((tmpMap.get("num"))));
			}
			innerMap.put("id", "2100");
			innerMap.put("name", "流感(Flu)");
			innerMap.put("num", sum + "");
			yi_nao_mie_huo_Maps.clear();
			yi_nao_mie_huo_Maps.add(innerMap);
			sum = 0;
			innerMap = null;

			// 流感总数计算和结果拼接
			innerMap = new HashMap<String, String>();
			for (int i = 0; i < liu_gan_Maps.size(); i++) {
				HashMap<String, String> tmpMap = liu_gan_Maps.get(i);
				sum += Integer.parseInt(String.valueOf((tmpMap.get("num"))));
			}
			innerMap.put("id", "2100");
			innerMap.put("name", "流感(Flu)");
			innerMap.put("num", sum + "");
			liu_gan_Maps.clear();
			liu_gan_Maps.add(innerMap);
			sum = 0;
			innerMap = null;

			String yi_gan_Str = JsonMapper.toJsonString(yi_gan_Maps);
			String chu_xue_re_Str = JsonMapper.toJsonString(chu_xue_re_Maps);
			String jia_gan_jian_du_Str = JsonMapper.toJsonString(jia_gan_jian_du_Maps);
			String kuang_quan_Str = JsonMapper.toJsonString(kuang_quan_Maps);
			String feng_zhen_Str = JsonMapper.toJsonString(feng_zhen_Maps);
			String chang_dao_71_Str = JsonMapper.toJsonString(chang_dao_71_Maps);
			String yi_nao_mie_huo_Str = JsonMapper.toJsonString(yi_nao_mie_huo_Maps);
			String liu_gan_Str = JsonMapper.toJsonString(liu_gan_Maps);
			String maps_Str = JsonMapper.toJsonString(maps);
			String result = maps_Str.replace("]", "") + "," + yi_gan_Str.replace("[", "").replace("]", "") + ","
					+ chu_xue_re_Str.replace("[", "").replace("]", "") + ","
					+ jia_gan_jian_du_Str.replace("[", "").replace("]", "") + ","
					+ kuang_quan_Str.replace("[", "").replace("]", "") + ","
					+ feng_zhen_Str.replace("[", "").replace("]", "") + ","
					+ chang_dao_71_Str.replace("[", "").replace("]", "") + ","
					+ yi_nao_mie_huo_Str.replace("[", "").replace("]", "") + "," + liu_gan_Str.replace("[", "");
			model.addAttribute("maps", result);
			model.addAttribute("maps", JsonMapper.toJsonString(maps));
		} else {
			exportChildhelp.setYearStr(DateUtils.getYear());
			exportChildhelp.setStartMonth("1");
			exportChildhelp.setEndMonth(Integer.valueOf(DateUtils.getMonth())-1 + "");
			model.addAttribute("date", DateUtils.formatDate(new Date(), "yyyy年MM月dd日"));
			return "modules/export/routineVacc6_2";
		}
		model.addAttribute("yearStr",exportChildhelp.getYearStr());
		model.addAttribute("startMonth",exportChildhelp.getStartMonth());
		model.addAttribute("endMonth",exportChildhelp.getEndMonth());
		model.addAttribute("date", DateUtils.formatDate(new Date(), "yyyy年MM月dd日"));
		return "modules/export/routineVacc6_2";
	}
	
	  /**
     * 设置基本属性
     * @author Jack
     * @date 2017年11月6日 上午10:02:10
     * @description 
     *
     */
    private void setInfo(ExportChildhelp exportChildhelp, Model model){
    	if(StringUtils.isNotBlank(exportChildhelp.getYearStr()) && StringUtils.isNotBlank(exportChildhelp.getStartMonth()) && StringUtils.isNotBlank(exportChildhelp.getEndMonth())){
			//处理和绑定时间
			exportChildhelp.setStartTime(TimeUtils.getFirstDayOfMonth(Integer.valueOf(exportChildhelp.getYearStr()),Integer.parseInt(exportChildhelp.getStartMonth())-1)+" "+"00:00:00");
			exportChildhelp.setEndTime(TimeUtils.getLastDayOfMonth(Integer.valueOf(exportChildhelp.getYearStr()),Integer.parseInt(exportChildhelp.getEndMonth())-1)+" "+"23:59:59");
		}else{
			//默认设置 开始月份:当年1月,结束月份:当月的上一个月份
			Integer nowMonth = Integer.parseInt(DateUtils.getMonth());
			exportChildhelp.setStartTime((Integer.valueOf(DateUtils.formatDate(new Date(), "yyyy")))+"-"+(DateUtils.formatDate(new Date(), "MM"))+"-01"+" "+"00:00:00");
			exportChildhelp.setEndTime(TimeUtils.getLastDayOfMonth(Integer.valueOf(DateUtils.formatDate(new Date(), "yyyy")), Integer.valueOf(DateUtils.formatDate(new Date(), "MM"))-1)+" "+"23:59:59");
			exportChildhelp.setYearStr(DateUtils.formatDate(new Date(), "yyyy"));
			exportChildhelp.setStartMonth("01");
			exportChildhelp.setEndMonth(nowMonth-1 + "");
		}
    }

	// ------------------------------------------常规免疫接种情况6-2汇总表结束-----------------------------------------------------------------//
	// 需要注意的是：月份是从0开始的，比如说如果输入5的话，实际上显示的是4月份的最后一天，千万不要搞错了哦
	public static String getLastDayOfMonth(int year, int month) {
		Calendar cal = Calendar.getInstance();
		cal.set(Calendar.YEAR, year);
		cal.set(Calendar.MONTH, month);
		cal.set(Calendar.DAY_OF_MONTH, cal.getActualMaximum(Calendar.DATE));
		return new SimpleDateFormat("yyyy-MM-dd ").format(cal.getTime());
	}

	public static String getFirstDayOfMonth(int year, int month) {
		Calendar cal = Calendar.getInstance();
		cal.set(Calendar.YEAR, year);
		cal.set(Calendar.MONTH, month);
		cal.set(Calendar.DAY_OF_MONTH, cal.getMinimum(Calendar.DATE));
		return new SimpleDateFormat("yyyy-MM-dd ").format(cal.getTime());
	}

	/**
	 * 6-2二类报表数据
	 * 
	 * @author Jack
	 * @date 2017年10月23日 下午6:39:33
	 * @description
	 * @param map
	 * @return
	 *
	 */
	public List<HashMap<String, String>> typeTwoVaccReport6_2(HashMap<String, Object> map) {
		return dao.typeTwoVaccReport6_2(map);
	}

	/**
	 * 常规免疫接种情况6-2汇总表 数据处理
	 * 
	 * @author Jack
	 * @date 2017年10月24日 上午9:24:46
	 * @description
	 * @param map
	 * @return
	 *
	 */
	public List<HashMap<String, Object>> selectVaccData6_2(HashMap<String, Object> map) {
		return dao.selectVaccData6_2(map);
	}
}
